/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.CustomerManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ 
/*    */ public class CheckQQIsExist extends AbstractAction
/*    */ {
    /*    */
    public CheckQQIsExist(AbstractHttpServlet servlet)
/*    */ {
/* 24 */
        super(servlet);
/*    */
    }

    /*    */
/*    */
    public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */ {
/* 38 */
        User user = super.getLoginUser(request);
/*    */ 
/* 40 */
        response.setContentType("text/html;charset=utf-8");
/* 41 */
        PrintWriter out = response.getWriter();
/* 42 */
        JSONObject jsonObject = new JSONObject();
/*    */ 
/* 44 */
        String qqs = Util.getURLParameter(request.getParameter("qq"));
/* 45 */
        if ((qqs == null) || (qqs.trim().length() == 0)) {
/* 46 */
            super.showSuccessMessage(response);
/* 47 */
            return;
/*    */
        }
/*    */ 
/* 50 */
        CustomerManager manager = new CustomerManager();
/* 51 */
        StringBuffer result = new StringBuffer();
/* 52 */
        for (String qq : qqs.split(",")) {
/* 53 */
            List items = manager.checkExistQQ(
/* 54 */         user.companyId, qq);
/* 55 */
            if ((items != null) && (items.size() != 0))
/*    */ {
/* 58 */
                for (Object itemO : items) {
                    Map item = (Map) itemO;
/* 59 */
                    result.append("[" + item.get("Name") + "]" + " \r QQ: " + qq +
/* 60 */             "\r");
/*    */
                }
/*    */
            }
/* 63 */
            if ((result == null) || (result.length() == 0)) {
/* 64 */
                jsonObject.put("error", "0");
/*    */
            } else {
/* 66 */
                jsonObject.put("error", "1");
/* 67 */
                jsonObject.put("result", result.toString());
/*    */
            }
/* 69 */
            out.println(jsonObject);
/* 70 */
            out.flush();
/* 71 */
            out.close();
/*    */
        }
/*    */
    }
}

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.CheckQQIsExist
 * JD-Core Version:    0.6.1
 */